import axios from '@/lib/axios'
const $API = '/api'

// 获取广告位列表接口
const getAdvertiseByType = data => axios.post(
  `${$API}/advertise/getAdvertiseByType`,
  data,
)

// 获取淘宝官方物料接口
const materialList = data => axios.post(
  `${$API}/taobao/material`,
  data,
)

// 将淘口令解析成不带pid的url链接
const tklToUrl = data => axios.post(
  `${$API}/taobao/tkltourl`,
  data,
)

// 获取商品历史价格接口
const getItemHistory = data => axios.post(
  `${$API}/item/queryhistory`,
  data,
)

// 淘宝官方获取商品详情接口
const getItemDetailTb = data => axios.post(
  `${$API}/taobao/itemdetail`,
  data,
)

// 发送短信验证码
const verifySend = data => axios.post(
  `${$API}/user/verifySend`,
  data,
)

// 短信登陆接口
const verifyLogin = data => axios.post(
  `${$API}/user/verifyLogin`,
  data,
)

// 微信登陆接口
const wechatLogin = data => axios.post(
  `${$API}/user/wechatLogin`,
  data,
)

// QQ登陆接口
const qqLogin = data => axios.post(
  `${$API}/user/qqLogin`,
  data,
)

// 头条小程序登陆接口
const ttLogin = data => axios.post(
  `${$API}/user/ttLogin`,
  data,
)

// 获取用户信息
const getUserInfo = data => axios.post(
  `${$API}/user/info`,
  data,
)

// 收藏/取消收藏商品
const favoriteItem = data => axios.post(
  `${$API}/favorite/favorite`,
  data,
)

// 获取商品收藏状态
const getFavoriteStatus = data => axios.post(
  `${$API}/favorite/status`,
  data,
)

// 分页获取收藏列表
const pagingFavorite = data => axios.post(
  `${$API}/favorite/paging`,
  data,
)

// 分页获取淘礼金
const pagingCashgift = data => axios.post(
  `${$API}/cashgift/paging`,
  data,
)

// 创建淘礼金
const createCashgift = data => axios.post(
  `${$API}/cashgift/create`,
  data,
)

// 注销淘礼金
const cancelCashgift = data => axios.post(
  `${$API}/cashgift/cancel`,
  data,
)

// 用户签到
const checkIn = data => axios.post(
  `${$API}/checkin/checkin`,
  data,
)

// 分页获取积分明细
const pagingGoldrecord = data => axios.post(
  `${$API}/goldrecord/paing`,
  data,
)

// 分页获取订单列表
const pagingOrderList = data => axios.post(
  `${$API}/order/paging`,
  data,
)

// 用户输入订单号结算订单
const settleOrder = data => axios.post(
  `${$API}/order/settle`,
  data,
)

// 用户输入订单号绑定订单
const bindOrder = data => axios.post(
  `${$API}/order/bind`,
  data,
)

export default {
  getAdvertiseByType,
  materialList,
  tklToUrl,
  getItemHistory,
  getItemDetailTb,
  verifySend,
  verifyLogin,
  wechatLogin,
  qqLogin,
  ttLogin,
  getUserInfo,
  favoriteItem,
  getFavoriteStatus,
  pagingFavorite,
  pagingCashgift,
  createCashgift,
  cancelCashgift,
  checkIn,
  pagingGoldrecord,
  pagingOrderList,
  settleOrder,
  bindOrder,
}
